#ifndef __HMI_MODULE_H__
#define __HMI_MODULE_H__

#include "common.h"
#include "global_config.h"
#include "dc_serial_screen.h"

/* HMI更新间隔 */
#define HMI_UPDATE_INTERVAL 500  /* 500ms */

/* HMI操作类型 */
typedef enum {
    HMI_OP_NONE = 0,
    HMI_OP_SET_TEMPERATURE,
    HMI_OP_SET_PID_PARAM,
    HMI_OP_SET_ALARM_LIMIT,
    HMI_OP_CHANGE_MODE,
    HMI_OP_RESET_ALARM,
    HMI_OP_SAVE_CONFIG
} hmi_operation_t;

/* HMI事件结构 */
typedef struct {
    hmi_operation_t op_type;
    uint16_t address;
    uint32_t value;
    float float_value;
    char string_value[32];
} hmi_event_t;

/* 函数声明 */
rt_err_t hmi_module_init(void);
void hmi_thread_entry(void *parameter);
rt_err_t hmi_update_display_data(void);
rt_err_t hmi_process_event(hmi_event_t *event);
rt_err_t hmi_show_alarm_page(void);
rt_err_t hmi_show_main_page(void);
rt_err_t hmi_update_trend_data(void);

/* 外部配置访问 */
extern screen_page_t get_current_screen_page(void);

#endif /* __HMI_MODULE_H__ */